#!/bin/bash

Current_PATH=$(cd $(dirname $0) && pwd)
cd ${Current_PATH}
pwd
./stop.sh
sleep 1
./start.sh
sleep 1

ZLMediaKit_URL="127.0.0.1"
ZLMediaKit_secret="035c73f7-bb6b-4889-a715-d9eb2d1925cc"
defaultVhost="__defaultVhost__"

echo "http://${ZLMediaKit_URL}/index/api/addStreamProxy?secret=${ZLMediaKit_secret}&vhost=${defaultVhost}&app=live&stream=test&url=rtsp://admin:julong123@192.168.1.87/media/video1&enable_rtsp=1&enable_rtmp=1&enable_hls=0&enable_mp4=0&rtp_type=0"

wget -qO- "http://${ZLMediaKit_URL}/index/api/addStreamProxy?secret=${ZLMediaKit_secret}&vhost=${defaultVhost}&app=live&stream=test&url=rtsp://admin:julong123@192.168.1.87/media/video1&enable_rtsp=1&enable_rtmp=1&enable_hls=0&enable_mp4=0&rtp_type=0"

sleep 1

echo "http://${ZLMediaKit_URL}/index/api/getMediaInfo?secret=${ZLMediaKit_secret}&schema=rtsp&vhost=${defaultVhost}&app=live&stream=test"

wget -qO- "http://${ZLMediaKit_URL}/index/api/getMediaInfo?secret=${ZLMediaKit_secret}&schema=rtsp&vhost=${defaultVhost}&app=live&stream=test"

echo "-----------------------------------------------------------"
for((i=0;i<3600;i++))
do
    wget -qO- "http://${ZLMediaKit_URL}/index/api/getMediaList?secret=${ZLMediaKit_secret}" | grep -F "1935/live" | wc
    echo "-----------------------------------------------------------"
    sleep 1
done
